package com.appheader.rongmaphone.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * Created by zhep on 2016/10/21.
 */
public class FileUtil {
    public static String readFile(String path) {
        String laststr = "";
        File projectFile = new File(path);
        if (projectFile.isFile() && projectFile.exists()) {
            BufferedReader reader = null;
            try {
                reader = new BufferedReader(new FileReader(projectFile));
                String tempString = null;
//int line=1;
                while ((tempString = reader.readLine()) != null) {
//System.out.println("line"+line+":"+tempString);
                    laststr = laststr + tempString;
//line++;
                }
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (reader != null) {
                    try {
                        reader.close();
                    } catch (IOException el) {
                    }
                }
            }
        }

        return laststr;
    }
}
